package com.formiaomiao.demain.service.impl;

import com.formiaomiao.demain.dao.ThemeDao;
import com.formiaomiao.demain.dao.UserDao;
import com.formiaomiao.demain.model.Result;
import com.formiaomiao.demain.model.ResultData;
import com.formiaomiao.demain.model.ThemeBean;
import com.formiaomiao.demain.model.ThemeRultData;
import com.formiaomiao.demain.service.ThemeService;
import com.formiaomiao.demain.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = "themeService")
public class ThemeServiceImpl implements ThemeService {

    @Autowired
    private ThemeDao themeDao;//这里会报错，但是并不会影响

    @Override
    public Result<ThemeBean> selectTheme() {
        if (themeDao.selectTheme() == null) {
            return ResultUtil.error(60, "主题获取失败");
        } else {
            ThemeRultData data = new ThemeRultData(themeDao.selectTheme());
            return ResultUtil.success(data);
        }
    }
}
